package main

import (
	"flag"
	"github.com/Exleryz/m3u8/constant"
	"github.com/Exleryz/m3u8/internal/m3u8/parser"
	"github.com/Exleryz/m3u8/internal/ts/download"
	"github.com/Exleryz/m3u8/internal/ts/merge"
	"github.com/Exleryz/m3u8/util"
)

func init() {
	// 配置项
	// 1. 是否使用代理
	// -p http://127.0.0.1:7890
	flag.StringVar(&util.ProxyUrl, "p", "", "http proxy url")
	// 2. 是否执行 ffmpeg merge
	flag.BoolVar(&constant.Merge, "m", false, "ffmpeg merge")
	flag.Parse()

	// constant.Merge = merge
}

func main() {
	parser := parser.M3U8Parser{}
	info, err := parser.Parser("test0",
		"http://127.0.0.1/index.m3u8")
	if err != nil {
		return
	}

	downloader := download.TsDownload{}
	downloader.Download(info)

	merge.TsMerge2Ts(info)
}
